package com.neo.service;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;


@Service
public class TransferProductService {

    protected static Logger logger= LoggerFactory.getLogger(TransferProductService.class); 
    
	@Autowired
    private JdbcTemplate jdbcTemplate;
	public void insert_jx_invest_project_product(){
		
		//查询旧的产品表
		StringBuilder select_sql = new StringBuilder("SELECT * FROM inv_invest_project");
		
		List<Map<String,Object>> inv_datas = jdbcTemplate.queryForList(select_sql.toString(),new Object[]{});
		
		if(inv_datas != null && inv_datas.size() > 0){
			
			for(Map<String,Object> inv_data : inv_datas){
				StringBuilder insert_sql = new StringBuilder("INSERT INTO jx_invest_project_product VALUES (");
				insert_sql.append("PRODUCT_CODE,");
				insert_sql.append("ASSET_CODE,");//资产方code
				insert_sql.append("CAPTAIL_CODE,");//资金方code
				insert_sql.append("STATUS,");//产品状态
				//insert_sql.append("IS_MANUAL_AUDIT,");//是否人工审核
				insert_sql.append("PROJECT_TYPE,");//标的类型
				insert_sql.append("INTEREST_RATE,");//结息方式
				insert_sql.append("MIN_INV_AMOUNT,");//起投金额限制
				insert_sql.append("NEWUSER_MIN_INV_AMOUNT,");//新手起投金额限制
				insert_sql.append("MAX_INV_AMOUNT,");//单笔投资上限
				insert_sql.append("MAX_INV_COUNT,");//最高投资次数限制
				insert_sql.append("MAX_INV_TOTAL_AMOUNT,");//累计投资金额上限控制
				insert_sql.append("IS_COLLECT_SUPINVESTOR_POUNDAGE,");//是否收取超级投资人手续费
				insert_sql.append("IS_PERSONAL_TRANSFER,");//个人是否可以转让
				insert_sql.append("PERSONAL_TRANSFER_POUNDAGE,");//个人转让手续费
				insert_sql.append("BAN_TRANSFER_DAY,");
				insert_sql.append("START_TRANSFER_DAY,");
				insert_sql.append("INVEST_TARGET,");
				insert_sql.append("DUE_DATE,");
				insert_sql.append("SAFEGUARD_LEVEL,");
				insert_sql.append("PROFIT_SHARE,");
				insert_sql.append("EXIST_SYSTEM,");
				insert_sql.append("COSTDES,");
				insert_sql.append("APP_DESC,");
				insert_sql.append("COMMON_QUESTION,");
				insert_sql.append("PROJECT_INVEST_TYPE,");
				//insert_sql.append("DAILY_LIMIT,");//每日限额
				//insert_sql.append("IS_AUTO_LOAN,");//是否自动放款
				//insert_sql.append("IS_ROBOT_POST,");//每日债转人额度用完
				//insert_sql.append("IS_SUPER_INVESTOR,");//标的处理方式
				insert_sql.append("INVESTMENT_PERIOD,");//投资期限
				insert_sql.append("ANNUALIZED_INTEREST_RATE,");//年化率
				insert_sql.append("IS_THANKS_GOLD,");//是否计算感谢金
				insert_sql.append("SHOW_INTEREST_RATE,");//显示利率
				insert_sql.append("PROJECT_NO,");//项目编号
				//insert_sql.append("PROJECT_NAME,");//项目名称
				//insert_sql.append("SET_PROJECT_NO,");//集合标编号
				//insert_sql.append("SORT,");//排序
				//insert_sql.append("FIRST_IMPORT_AMOUNT,");
				insert_sql.append("AGREEMENT,");
				insert_sql.append("ENABLE_AMT,");
				//insert_sql.append("IS_RECOMMEND,");
				insert_sql.append("PRIORITY,");
				//insert_sql.append("IS_ENABLE,");
				insert_sql.append("SHELVE,");//上下架
				insert_sql.append("RATE_TYPE,");//计息方式
				insert_sql.append(") VALUES (");
				
				//添加数据
				insert_sql.append("'" + inv_data.get("PRODUCT_CODE") + "'");
				insert_sql.append("'" + inv_data.get("") + "'");
				insert_sql.append("'" + inv_data.get("") + "'");
				insert_sql.append("'" + inv_data.get("STATUS") + "'");
				//insert_sql.append("'" + inv_data.get("") + "'");//是否人工审核
				insert_sql.append("'" + 1 + "'");//标的类型-债转标
				insert_sql.append("'" + inv_data.get("INTEREST_RATE") + "'");
				insert_sql.append("'" + inv_data.get("MIN_INV_AMOUNT") + "'");
				insert_sql.append("'" + inv_data.get("NEWUSER_MIN_INV_AMOUNT") + "'");
				insert_sql.append("'" + inv_data.get("MAX_INV_AMOUNT") + "'");
				insert_sql.append("'" + inv_data.get("MAX_INV_COUNT") + "'");
				insert_sql.append("'" + inv_data.get("MAX_INV_TOTAL_AMOUNT") + "'");
				insert_sql.append("'" + inv_data.get("IS_COLLECT_SUPINVESTOR_POUNDAGE") + "'");
				insert_sql.append("'" + inv_data.get("IS_PERSONAL_TRANSFER") + "'");
				insert_sql.append("'" + inv_data.get("PERSONAL_TRANSFER_POUNDAGE") + "'");
				insert_sql.append("'" + inv_data.get("BAN_TRANSFER_DAY") + "'");
				insert_sql.append("'" + inv_data.get("START_TRANSFER_DAY") + "'");
				insert_sql.append("'" + inv_data.get("INVEST_TARGET") + "'");
				insert_sql.append("'" + inv_data.get("DUE_DATE") + "'");
				insert_sql.append("'" + inv_data.get("SAFEGUARD_LEVEL") + "'");
				insert_sql.append("'" + inv_data.get("PROFIT_SHARE") + "'");
				insert_sql.append("'" + inv_data.get("EXIST_SYSTEM") + "'");
				insert_sql.append("'" + inv_data.get("COSTDES") + "'");
				insert_sql.append("'" + inv_data.get("APP_DESC") + "'");
				insert_sql.append("'" + inv_data.get("COMMON_QUESTION") + "'");
				insert_sql.append("'" + inv_data.get("TYPE_NAME") + "'");
				//insert_sql.append("'" + inv_data.get("") + "'");//每日限额
				//insert_sql.append("'" + inv_data.get("") + "'");//是否自动放款
				//insert_sql.append("'" + inv_data.get("") + "'");//每日债转人额度用完
				//insert_sql.append("'" + inv_data.get("") + "'");//标的处理方式
				insert_sql.append("'" + inv_data.get("INVEST_MENT") + "'");
				insert_sql.append("'" + inv_data.get("INVEST_RATE") + "'");
				insert_sql.append("'" + inv_data.get("IS_COMMISSION") + "'");
				insert_sql.append("'" + inv_data.get("SHOW_INTEREST_RATES") + "'");
				insert_sql.append("'" + inv_data.get("PROJECT_NO") + "'");
				//insert_sql.append("'" + inv_data.get("") + "'");//项目名称
				//insert_sql.append("'" + inv_data.get("") + "'");//集合标编号
				//insert_sql.append("'" + inv_data.get("") + "'");//排序
				//insert_sql.append("'" + inv_data.get("") + "'");//首次导入金额
				insert_sql.append("'" + inv_data.get("AGREEMENT") + "'");
				insert_sql.append("'" + inv_data.get("ENABLE_AMT") + "'");
				//insert_sql.append("'" + inv_data.get("") + "'");//是否需要首页推荐
				insert_sql.append("'" + inv_data.get("PRIORITY") + "'");
				//insert_sql.append("'" + inv_data.get("") + "'");//是否启动
				insert_sql.append("'" + inv_data.get("IS_SHELVES") + "'");
				insert_sql.append("'" + inv_data.get("INTEREST_SUM_MODE") + "'");
				
			}
		}
	}
}
